import QtQuick 2.9
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12

ApplicationWindow {
    id: root
    visible: true
    width: 480
    height: 640
    title: qsTr("POCT-HPY")

    property string g_currentUser: ""
    property string g_currentBox: ""


    function logout() {
        contentLoader.sourceComponent = loginForm
    }

    ///////////////////////////////////////////// UI ////

    Loader {
        id: contentLoader
        sourceComponent: loginForm
    }

    Component {
        id: loginForm
        Login {
            width: root.width
            height: root.height

            onLoginSuccess:  {
                g_currentUser = user
                contentLoader.sourceComponent = homeForm;
            }
        }
    }

    Component {
        id: homeForm
        Home {
            width: root.width
            height: root.height
        }
    }
}
